import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { ProjectChangeVO, ProjectChangeForm, ProjectChangeQuery } from '@/pagesA/api/workflow/projectChange/types';

/**
 * 查询项目变更申请单列表
 * @param query
 * @returns {*}
 */

export const listProjectChange = (query?: ProjectChangeQuery): AxiosPromise<ProjectChangeVO[]> => {
  return request({
    url: '/workflow/projectChange/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询项目变更申请单详细
 * @param id
 */
export const getProjectChange = (id: string | number): AxiosPromise<ProjectChangeVO> => {
  return request({
    url: '/workflow/projectChange/' + id,
    method: 'get'
  });
};

/**
 * 新增项目变更申请单
 * @param data
 */
export const addProjectChange = (data: ProjectChangeForm) => {
  return request({
    url: '/workflow/projectChange',
    method: 'post',
    data: data
  });
};

/**
 * 修改项目变更申请单
 * @param data
 */
export const updateProjectChange = (data: ProjectChangeForm) => {
  return request({
    url: '/workflow/projectChange',
    method: 'put',
    data: data
  });
};

/**
 * 删除项目变更申请单
 * @param id
 */
export const delProjectChange = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/projectChange/' + id,
    method: 'delete'
  });
};
